using System.Linq;

namespace Pdf2epub.Model
{
    public class FontAssignmentDataCollection : BaseCollection<FontAssignmentData>
    {
        public FontAssignmentData this[FontAssignmentData fontAssignment]
        {
            get { return this.FirstOrDefault(fontAssignmentData => fontAssignmentData.CompareTo(fontAssignment) == 0); }
        }

        public FontAssignmentData this[FontUsage fontUsage]
        {
            get { return this.FirstOrDefault(fontAssignmentData => fontAssignmentData.FontUsage.CompareTo(fontUsage) == 0); }
        }

        public bool Contains(FontUsage font)
        {
            return this.Any(data => data.FontUsage.CompareTo(font) == 0);
        }
    }
}